package com.my.code.testcode.并发包;

import java.util.Random;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;

/**
 * 描述:
 * 我的任务
 *
 * @author 54485
 * @create 2018-09-18 13:37
 */
public class MyTask implements Callable<String> {

    private String msg;

    public MyTask(String msg) {
        this.msg = msg;
    }

    @Override
    public String call() throws Exception {
        Random rand = new Random();
        TimeUnit.SECONDS.sleep(rand.nextInt(5));
        return Thread.currentThread().getName();
    }
}
